﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Asion.Dapper.SqlBuilder
{
    public interface IEncapSulation
    {
        public string EncapSulation(string name);


        public string EncapCloumnParam(string name);


        public string EncapCloumnValue(string name);
    }

    public class MySqlEncapSulation : IEncapSulation
    {
        public string EncapCloumnParam(string name)
        {
            return $"@{name}";
        }

        public string EncapCloumnValue(string name)
        {
            //name = SqlInjectionCleaner.Clean(name);
            return $"'{name}'";
        }

        public string EncapSulation(string name)
        {
            return $"`{name}`";
        }
    }

    public class EncapSulationFactory
    {
        public static IEncapSulation Create(DatabaseType dbType)
        {
            IEncapSulation encap;
            if (dbType == DatabaseType.MySQL)
            {
                return new MySqlEncapSulation();
            }
            throw new NotImplementedException();
        }
    }

}
